//
//  BaseModel.m
//  Manage
//
//  Created by 杨康 on 2018/2/12.
//  Copyright © 2018年 杨康. All rights reserved.
//

#import "BaseModel.h"

@implementation BaseModel
- (instancetype)initWithDictionary:(NSDictionary *)dict {
    self = [super init];
    if (self != nil) {
        [self setValuesForKeysWithDictionary:dict];
    }
    return self;
}
// 重写setValue:forUndefinedKey:方法
- (void)setValue:(id)value forUndefinedKey:(NSString *)key {
    NSLog(@"key = %@, value = %@", key, value);
}
- (nullable id)valueForUndefinedKey:(NSString *)key
{
    return @"";
}
-(void)setNilValueForKey:(id) key
{
//    if([key isEqualToString:@"price"])
//    {
        [self setValue:@"" forKey:key];
//    }
//    else
//    {
//        //回调父类的setNilValueForKey，执行默认行为
//        [super setNilValueForKey:key];
//    }
}
- (NSString *)description {
    return @"";
}
@end
